
import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';

class AppLocals{
   late final Locale locale;

   AppLocals(this.locale);

   static Map<String,Map<String,String>> _locals={
    "en":{
      "title":"title"

    },
    "zh":{
      "title":"标题"
    }
  };
  String? get title{
    return _locals[locale.languageCode]?['title'];
  }
  static AppLocals of(BuildContext context) {
    return Localizations.of<AppLocals>(context,AppLocals)!;
  }

}

class AppLocalDelegete extends LocalizationsDelegate<AppLocals> {
  @override
  bool isSupported(Locale locale) {
    return  true;
  }

  @override
  Future<AppLocals> load(Locale locale) {
    return SynchronousFuture<AppLocals>(AppLocals(locale));
  }

  @override
  bool shouldReload(covariant LocalizationsDelegate<AppLocals> old) {
    return false;
  }
}